package com.robotserver.orders.jobs.xxljob;

import com.robotserver.orders.service.PullTokensService;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class PullTokensSyncXxlJob {
    private static Logger logger = LoggerFactory.getLogger(PullTokensSyncXxlJob.class);

    @Autowired
    private PullTokensService pullTokensService;

    /**
     * 调用工具商拉取订单3.0订单
     * 每30秒钟执行一次拉取订单（时间范围是3分钟）
     */
    @XxlJob("pushTokensByAppKeyHandler")
    public void pushTokensByAppKeyHandler() {
        logger.info("--------PullTokensSyncXxlJob pushTokensByAppKeyHandler------start------");
        pullTokensService.pullTokens();
    }

    /**
     * 调用工具商拉取订单拉取2.0订单
     * 每30秒钟执行一次拉取订单（时间范围是3分钟）
     */
    @XxlJob("pushTokensByAppKeyHandler_V2")
    public void pushTokensByAppKeyHandler_V2() {
        logger.info("--------PullTokensSyncXxlJob pushTokensByAppKeyHandler_V2------start------");
        pullTokensService.pullTokens_V2();
    }

}
